//
//  WHYSocietyCell.m
//  News163
//
//  Created by 王洪运 on 16/1/7.
//  Copyright © 2016年 王洪运. All rights reserved.
//

#import "WHYSocietyCell.h"
#import "WHYSociety.h"
#import "UIImageView+WebCache.h"

@interface WHYSocietyCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyLabel;


@end

@implementation WHYSocietyCell

-(void)setSocity:(WHYSociety *)socity {
    _socity = socity;
    
    self.titleLabel.text = socity.title;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:socity.imgsrc] placeholderImage:[UIImage imageNamed:@"loading"]];

    if (socity.hasHead) {
        return;
    }
    
    self.descLabel.text = socity.digest;
    self.replyLabel.text = [NSString stringWithFormat:@"%zd跟帖",socity.replyCount];
    
}

+(CGFloat)socirtyCellHeightWith:(WHYSociety *)society {
    if (society.hasHead) {
        return 180;
    }else {
        return 80;
    }
}

+(NSString *)socirtyCellIdentifierWith:(WHYSociety *)society {
    
    if (society.hasHead) {
        return @"BigImageCell";
    }else {
        return @"SocietyCell";
    }
    
}

@end
